/* =============================================================================
 * describe cross-sectional earnings profiles
 * ===========================================================================*/


/*******************************************************************************
******************************** US (Figure 1a) ********************************
*******************************************************************************/

use "data\US.dta", clear

drop if outlier

drop if age < 24
drop if age > 60

keep if male == 1

recode year (1986/1990 = 1)(1991/1995 = 2)(1996/2000 = 3)	///
	(2001/2004 = 4)(2005/2008 = 5)(2009/2012 = 6), gen(yeargroup)

twoway (lpolyci earn age if yeargroup == 1 [aw = asecwt], clcolor(blue) lpattern(shortdash) fcolor(%30))	///
	(lpolyci earn age if yeargroup == 2 [aw = asecwt], clcolor(red) lpattern(longdash) fcolor(%30))			///
	(lpolyci earn age if yeargroup == 3 [aw = asecwt], clcolor(green) fcolor(%30)),		///
	xlabel(25(5)60, labsize(medlarge)) ylabel(, labsize(medlarge)) 	///
	ytitle("Annual Earnings (2015 USD)", size(large)) xtitle("Age", size(large))		///
	legend(order(2 "1986-1990" 4 "1991-1995" 6 "1996-2000") rows(1) pos(6) size(medlarge))	///
	name(us_cs_left, replace)				

twoway (lpolyci earn age if yeargroup == 4 [aw = asecwt], clcolor(blue) lpattern(shortdash) fcolor(%30)) 								///
	(lpolyci earn age if yeargroup == 5 [aw = asecwt], clcolor(red) lpattern(longdash) fcolor(%30)) 			///
	(lpolyci earn age if yeargroup == 6 [aw = asecwt], clcolor(green) fcolor(%30)),		///
	xlabel(25(5)60, labsize(medlarge)) ylabel(, labsize(medlarge))  ///
	ytitle("Annual Earnings (2015 USD)", size(large)) xtitle("Age", size(large))	///
	legend(order(2 "2001-2004" 4 "2005-2008" 6 "2009-2012") rows(1) pos(6) size(medlarge))	///
	name(us_cs_right, replace)			
	
graph combine us_cs_left us_cs_right, xsize(16) ysize(8) ycommon 	
	
graph export "figures\us_cross_sectional_earnings.pdf", as(pdf) replace




/*******************************************************************************
****************************** China (Figure 1b) *******************************
*******************************************************************************/

use "data\China.dta", clear

keep if inlist(prov,21,31,44,51)	// provinces covered in all years

drop if outlier

drop if age < 24
drop if age > 60

keep if male == 1

recode year (1986/1990 = 1)(1991/1995 = 2)(1996/2000 = 3)	///
	(2001/2004 = 4)(2005/2008 = 5)(2009/2012 = 6), gen(yeargroup)
	
twoway (lpolyci earn age if yeargroup == 1, clcolor(blue) lpattern(shortdash) fcolor(%30))	///
	(lpolyci earn age if yeargroup == 2, clcolor(red) lpattern(longdash) fcolor(%30))		///
	(lpolyci earn age if yeargroup == 3, clcolor(green) fcolor(%30)),	///
	xlabel(25(5)60, labsize(medlarge))  ylabel(5000(3000)17000, labsize(medlarge)) 	///
	ytitle("Annual Earnings (2015 CNY)", size(large))	xtitle("Age", size(large))	///
	legend(order(2 "1986-1990" 4 "1991-1995" 6 "1996-2000") rows(1) pos(6) size(medlarge))	///
	name(cn_cs_left, replace)				

twoway (lpolyci earn age if yeargroup == 4, clcolor(blue) lpattern(shortdash) fcolor(%30)) ///
	(lpolyci earn age if yeargroup == 5, clcolor(red) lpattern(longdash) fcolor(%30)) 		///
	(lpolyci earn age if yeargroup == 6, clcolor(green) fcolor(%30)) ,	///
	xlabel(25(5)60, labsize(medlarge))  ylabel(10000(10000)50000, labsize(medlarge))	///
	ytitle("Annual Earnings (2015 CNY)", size(large))	xtitle("Age", size(large))		///
	legend(order(2 "2001-2004" 4 "2005-2008" 6 "2009-2012") rows(1) pos(6) size(medlarge))	///
	name(cn_cs_right, replace)			
	
graph combine cn_cs_left cn_cs_right, xsize(16) ysize(8) 
	
graph export "figures\cn_cross_sectional_earnings.pdf", as(pdf) replace
